package com.ruoyi.batchinsert;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.seckill.SeckillMessage;
import com.ruoyi.seckill.SeckillService;
import com.ruoyi.system.domain.SeckillGoods;
import com.ruoyi.system.service.ISeckillGoodsService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.AbstractMap;
import java.util.List;

@RestController
@RequestMapping("/batch")
public class BatchInsertController extends BaseController {

    @Resource
    private SeckillService seckillService;
    @Resource
    private MultiThreadedBatchInsert multiThreadedBatchInsert;

    @PostMapping("/batchInsert")
    public AjaxResult batchInsert() {
        try {
            multiThreadedBatchInsert.batchInsert();
            return AjaxResult.success();
        } catch (Exception e) {
            return AjaxResult.error(e.getMessage());
        }
    }

}
